package cn.csc.module.pay.dal.mysql.notify;

import java.time.LocalDateTime;
import java.util.*;

import cn.csc.framework.common.pojo.PageResult;
import cn.csc.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csc.framework.mybatis.core.mapper.BaseMapperX;
import cn.csc.module.pay.dal.dataobject.notify.NotifyRefundLogDO;
import cn.csc.module.pay.dal.dataobject.notify.PayNotifyTaskDO;
import cn.csc.module.pay.dal.dataobject.order.PayOrderDO;
import cn.csc.module.pay.enums.notify.PayNotifyStatusEnum;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;


/**
 * 支付回调本地通知 App 的日志 Mapper
 *
 * @author 曾铁树
 */
@Mapper
public interface NotifyRefundLogMapper extends BaseMapperX<NotifyRefundLogDO> {

//    default PageResult<NotifyRefundLogDO> selectPage(NotifyRefundLogPageReqVO reqVO) {
//        return selectPage(reqVO, new LambdaQueryWrapperX<NotifyRefundLogDO>()
//                .eqIfPresent(NotifyRefundLogDO::getNotifyTimes, reqVO.getNotifyTimes())
//                .eqIfPresent(NotifyRefundLogDO::getResponse, reqVO.getResponse())
//                .eqIfPresent(NotifyRefundLogDO::getStatus, reqVO.getStatus())
//                .betweenIfPresent(NotifyRefundLogDO::getCreateTime, reqVO.getCreateTime())
//                .orderByDesc(NotifyRefundLogDO::getId));
//    }
//
//    default List<NotifyRefundLogDO> selectList(NotifyRefundLogExportReqVO reqVO) {
//        return selectList(new LambdaQueryWrapperX<NotifyRefundLogDO>()
//                .eqIfPresent(NotifyRefundLogDO::getNotifyTimes, reqVO.getNotifyTimes())
//                .eqIfPresent(NotifyRefundLogDO::getResponse, reqVO.getResponse())
//                .eqIfPresent(NotifyRefundLogDO::getStatus, reqVO.getStatus())
//                .betweenIfPresent(NotifyRefundLogDO::getCreateTime, reqVO.getCreateTime())
//                .orderByDesc(NotifyRefundLogDO::getId));
//    }

    default List<NotifyRefundLogDO> selectListByNotifyRefund() {
        return selectList(new QueryWrapper<NotifyRefundLogDO>()
                .in("status", PayNotifyStatusEnum.WAITING.getStatus(), PayNotifyStatusEnum.REQUEST_SUCCESS.getStatus(),
                        PayNotifyStatusEnum.REQUEST_FAILURE.getStatus()));
                //.le("next_notify_time", LocalDateTime.now()));
    }

}
